package com.higgins.client.agentapp.tabs;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.higgins.client.GreetingService;
import com.higgins.client.GreetingServiceAsync;
import com.higgins.client.agentapp.components.AdvertisedJobColumns;
import com.higgins.client.agentapp.components.AdvertisedJobListBox;
import com.higgins.client.agentapp.components.AdvertisedJobTable;
import com.higgins.client.agentapp.components.AgencyListBox;
import com.higgins.client.agentapp.components.AgentListBox;
import com.higgins.client.agentapp.components.CorrespondenceColumns;
import com.higgins.client.agentapp.components.CorrespondenceTable;
import com.higgins.client.agentapp.components.JobSiteColumns;
import com.higgins.client.agentapp.components.JobSiteTable;
import com.higgins.client.agentapp.controller.CorrespondencePanelController;
import com.higgins.client.agentapp.service.AgentAppService;
import com.higgins.client.agentapp.service.AgentAppServiceAsync;

public class CorrespondenceTab extends VerticalPanel {
	private final AgentAppServiceAsync agentAppService = GWT
		.create(AgentAppService.class);
	private boolean firstRun = true;
	public CorrespondenceTab()	{
	}
	public void update()	{
		if (firstRun)
			initialise();
		else
			refresh();
	}
	
	public void initialise()	{
		HorizontalPanel horizontalPanel = new HorizontalPanel();
		horizontalPanel.setSpacing(3);
		
		AgencyListBox agencyListBox = new AgencyListBox();
		AgentListBox agentListBox = new AgentListBox();
		AdvertisedJobListBox advertisedJobListBox = new AdvertisedJobListBox();

		CorrespondenceColumns columns = new CorrespondenceColumns();
		CorrespondenceTable table = new CorrespondenceTable(columns);

		CorrespondencePanelController controller = new CorrespondencePanelController();
		controller.setAgencyListBox(agencyListBox);
		controller.setAgentListBox(agentListBox);
		controller.setAdvertisedJobListBox(advertisedJobListBox);
		controller.setCorrespondenceTable(table);

		
		add(table);
		
		horizontalPanel.add(agencyListBox);
		horizontalPanel.add(agentListBox);
		horizontalPanel.add(advertisedJobListBox);
		
		add(horizontalPanel);
		add(table);
		firstRun = false;
	}
	public void refresh()	{
		
	}

}
